package com.huifaapp.mall.adapter.adapter2;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.huifaapp.mall.R;
import com.huifaapp.mall.bean.Huishengqian.Invite;
import com.jcodecraeer.xrecyclerview.XRecyclerView;

import java.util.List;

/**
 * @desc
 * @auth Mr Wu Fan
 * Created by you on 2018/3/20.
 */

public class Haoyouyaoqinadapter extends XRecyclerView.Adapter<Haoyouyaoqinadapter.viewhoder> {
        private Context context;
        private List<Invite.DataBean.ListBean> list;

    public Haoyouyaoqinadapter(Context context, List<Invite.DataBean.ListBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public viewhoder onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = View.inflate(context, R.layout.itemhyxq, null);
        viewhoder vh  =new viewhoder(inflate);
        return vh;
    }

    @Override
    public void onBindViewHolder(viewhoder holder, int position) {
        holder.textViewname.setText(list.get(position).getUserNickName());
        holder.textViewmoney.setText(list.get(position).getMoney()+"");
        Glide.with(context).
                load(list.get(position).getUserHeadImg()).into(holder.imageView);

    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class viewhoder extends XRecyclerView.ViewHolder{
        ImageView imageView;
        TextView textViewname;
         TextView textViewmoney;

            public viewhoder(View itemView) {
                super(itemView);
                imageView = (ImageView) itemView.findViewById(R.id.imagerview);
                textViewname = (TextView) itemView.findViewById(R.id.tvname);
                textViewmoney = (TextView) itemView.findViewById(R.id.tvmoeny);


            }
        }
}
